package top.zhangjianyong.tools.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import top.zhangjianyong.tools.user.VerifyUser;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;

/**
 * @author ： zhangjianyong
 * @date ： 2022/4/27 4:57 PM
 */
@VerifyUser(login = false)
@Slf4j
@Controller
@RequestMapping("/test")
public class TestController {

    @GetMapping("index")
    public String index(@RequestParam String code) {
        log.info("index:{}", code);
        return "redirect:http://www.baidu.com";
    }

    @ResponseBody
    @RequestMapping("/testPost")
    public String test(HttpServletRequest request) {
        Enumeration<String> parameterNames = request.getParameterNames();
        while (parameterNames.hasMoreElements()) {
            String s = parameterNames.nextElement();
            System.out.println(s + ":" + request.getParameter(s));
        }
        return "11111";
    }
}
